package xuanzhen.reservation.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import xuanzhen.reservation.dao.ReservationMapper;
import xuanzhen.reservation.pojo.Reservation;
import xuanzhen.reservation.service.ReservationService;
@Service
public class ReservationServiceImpl implements ReservationService {
	@Resource
	ReservationMapper reservationMapper;
	@Override
	public int insertReservation(Reservation reservation) throws Exception {
		reservationMapper.insertReservation(reservation);
		List<Reservation> resList = reservationMapper.selectListByEntity(reservation);
		if (resList.isEmpty()) {
			return 0;
		}else {
			return 1;
		}
		
	}

	@Override
	public int updateReservation(Reservation reservation) throws Exception {
		reservationMapper.updateReservation(reservation);
		List<Reservation> resList = reservationMapper.selectListByEntity(reservation);
		if (resList.isEmpty()) {
			return 0;
		}else {
			return 1;
		}
	}

	@Override
	public List<Reservation> queryListByEntity(Reservation reservation) throws Exception {
		List<Reservation> resList = reservationMapper.selectListByEntity(reservation);
		return resList;
	}

	@Override
	public List<Reservation> queryListByMap(Map<String, Object> parameter) throws Exception {
		List<Reservation> resList = reservationMapper.selectListByMap(parameter);
		return resList;
	}
	
	@Override
	public List<Reservation> queryLikeListByMap(Map<String, Object> parameter) throws Exception {
		List<Reservation> resList = reservationMapper.selectLikeListByMap(parameter);
		return resList;
	}
	
	@Override
	public List<Reservation> queryMessageListByMap(Map<String, Object> parameter) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int countUnDeul(Map<String, Object> parameter) throws Exception {
		int count = reservationMapper.countUnDeul(parameter);
		return count;
	}
	
	@Override
	public int countLikes(Map<String, Object> parameter) throws Exception {
		int count = reservationMapper.countLikes(parameter);
		return count;
	}

	@Override
	public int selectCountIllegal(Reservation reservation) throws Exception {
		// TODO Auto-generated method stub
		return reservationMapper.selectCountIllegal(reservation);
	}

	@Override
	public int selectCountIllegalChick(Reservation reservation) throws Exception {
		// TODO Auto-generated method stub
		return reservationMapper.selectCountIllegalChick(reservation);
	}

	@Override
	public List<Reservation> queryRedsCountLtListByMap(Map<String, Object> parameter) throws Exception {
		// TODO Auto-generated method stub
		return reservationMapper.queryRedsCountLtListByMap(parameter);
	}

	

}
